package com.ithw.intelligentcodeplatform.service;

import com.ithw.intelligentcodeplatform.model.dto.app.AppAddRequest;
import com.ithw.intelligentcodeplatform.model.dto.app.AppQueryRequest;
import com.ithw.intelligentcodeplatform.model.entity.User;
import com.ithw.intelligentcodeplatform.model.vo.AppVO;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.core.service.IService;
import com.ithw.intelligentcodeplatform.model.entity.App;
import reactor.core.publisher.Flux;

import java.io.Serializable;
import java.util.List;

/**
 * 应用 服务层。
 *
 * @author <a href="https://github.com/thw610013">Eee_tian</a>
 */
public interface AppService extends IService<App> {

    Long createApp(AppAddRequest appAddRequest, User loginUser);

    /**
     * 根据 id 获取应用详情
     * @param app 应用 id
     * @return 应用详情
     */
    AppVO getAppVO(App app);

    /**
     * 用户分页查询应用
     * @param appQueryRequest 分页查询请求
     * @return 分页查询结果
     */
    QueryWrapper getQueryWrapper(AppQueryRequest appQueryRequest);


    /**
     * 获取应用列表
     * @param appList 应用列表
     * @return 应用列表
     */
    List<AppVO> getAppVOList(List<App> appList);

    Flux<String> chatToGenCode(Long appId, String message, User loginUser);

    // 部署应用
    String deployApp(Long appId, User loginUser);

    void generateAppScreenshotAsync(Long appId, String appUrl);

    boolean removeById(Serializable id);
}
